package com.caine.androidtask.ls24;

import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceActivity.Header;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;

import com.caine.androidtask.R;
import com.caine.androidtask.ls22.MySwitchButton;

public class MyGestureListenerTest extends Activity {

	public static MySwitchButton mbtn;
	private GestureDetector mDetector;
	private Header h;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.caine_ls24);
		
		mbtn = (MySwitchButton) findViewById(R.id.switchbtn);
		
		mDetector = new GestureDetector(new GestureListener(this));
		//mDetector.set(true);
	}
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub
		
		return mDetector.onTouchEvent(event);
	}
	
	
	public static void setbtnshowOrdisable(int flag){
		if(mbtn==null)return;
		switch(flag){
		case 1 :
		 mbtn.setVisibility(View.GONE);
		 break;
		case 2 :
			mbtn.setVisibility(View.VISIBLE);	
			break;
			default:
				
		}
	}
}
